<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户登录页面</title>
    <link rel="stylesheet" href="/plugins/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery-3.7.1.min.js"></script>
    <script src="/plugins/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/plugins/bootstraptable/bootstrap-table.min.css">
    <style>
        body {
            background-color: #e1e0e0;
        }
        .container-fluid {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }
        #title{
            margin-bottom: 20px;
            text-align: center;
            font-size: 24px;
            font-weight: bold;
        }
        #content{
            border: 1px solid #393838;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            background-color: #f9f9f9;
        }
        .btn-primary {
            width: 100%;
            background-color: lightskyblue;
            color:white;
        }
    </style>
</head>
<body>
    <div class="container-fluid">
        <div class="panel panel-default" id="content">
            <div class="panel-heading" id="title">用户登录页面</div>
            <div class="panel-body">
                <form>
                    <div class="form-group">
                        <label for="username">用户名：</label>
                        <input type="text" class="form-control" id="username" aria-describedby="username">
                    </div>
                    <div class="form-group">
                        <label for="password">密码：</label>
                        <input type="password" class="form-control" id="password">
                    </div>
                    <div class="form-group form-check">
                        <input type="checkbox" class="form-check-input" id="exampleCheck1">
                        <label class="form-check-label" for="exampleCheck1">Check me out</label>
                    </div>
                    <button type="submit" id="loginButton" class="btn btn-primary" onclick="login();">登录</button>
                </form>
            </div>
        </div>
    </div>
    <script src="/plugins/bootstraptable/bootstrap-table.min.js"></script>
    <script src="/plugins/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>
    <script type="text/javascript">
        function login(){
            var name=$("#username").val();
            var password=$("#password").val();
            console.log('Username:', name);
            console.log('Password:', password);
            $.ajax({
                url:"/api/login/user",
                type: 'GET',
                data:{
                    username:name,
                    password:password,
                }
            }).done(function(rs){
                if(rs>=0){
                    //成功
                    window.location.href="/student/list3";
                }
                else{
                    alert("出错了，用户名或密码不正确");
                }
            })
        }
    </script>
</body>
</html>